<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>欢迎使用网上商城</title>
    <link rel="icon" th:href="@{/favicon.ico}" type="image/x-icon"/>
    <link rel="bookmark" th:href="@{/favicon.ico}" type="image/x-icon"/>
    <script src="../../../static/js/jquery/jquery-3.6.0.min.js" th:src="@{/js/jquery/jquery-3.6.0.min.js}"></script>
    <script src="../../../static/js/bootstrap/bootstrap.bundle.js"
            th:src="@{/js/bootstrap/bootstrap.bundle.js}"></script>
    <link rel="stylesheet" href="../../../static/css/bootstrap/bootstrap.css"
          th:href="@{/css/bootstrap/bootstrap.css}">
</head>
<body>
<div class="container">
    <h2>添加图书</h2>
    <div class="divider">
        <hr/>
    </div>
    <form action="" method="post" enctype="multipart/form-data">
        <input type="hidden" name="salesamount" value="0"><!-- 默认销量为0 -->
        <table class="table table-bordered">
            <tr>
                <th><h5><strong>图书名称</strong></h5></th>
                <td><input type="text" class="form-control" name="name" placeholder="请输入图书名称"/></td>
            </tr>
            <tr>
                <th><h5><strong>作者</strong></h5></th>
                <td><input type="text" class="form-control" name="author" placeholder="请输入作者名称"/></td>
            </tr>
            <tr>
                <th><h5><strong>售价</strong></h5></th>
                <td>
                    <input type="text" class="form-control" placeholder="请输入图书售价"
                           name="price"
                           onkeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"/>
                </td>
            </tr>
            <tr>
                <th><h5><strong>库存</strong></h5></th>
                <td>
                    <input type="text" class="form-control" name="storenumber" placeholder="请输入图书库存"
                           onkeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"/>
                </td>
            </tr>
            <tr>
                <th><h5><strong>图书封面</strong></h5></th>
                <td>
                    <input type="file" id="inputfile" name="imagepath"/>
                </td>
            </tr>
            <tr>
                <th><h5><strong>图书类别</strong></h5></th>
                <td>
                    <select class="form-control" name="categorysid" th:each="">
                        <option value="${category.id }">${category.name }</option>
                    </select>
                </td>
            </tr>
        </table>
        <div class="divider">
            <hr/>
        </div>
        <button type="submit" class="btn btn-success btn-block btn-lg" name="Btn">添加图书</button>
    </form>
</div>
</body>
</html>